<?php
/**
 *
 *
 *
 */
 
 /**
 *
 *
 *
 */
include_once "pdo_connect.php";
//include_once APPPATH . "libraries/createfastlib/db/CF_db_mysql.php";
include_once APPPATH . "libraries/createfastlib/db/CF_pdo_common.php";

class <cs_name>_mdl {
	static function do_update($keyvalues, $newvalues, $maintable){

		$result = CF_CrudLibPdo::CrudSave($keyvalues, $newvalues, $maintable);
		return $result;

	}

	static function do_delete($keyvalues,$maintable){
		$result = CF_CrudLibPdo::CrudDelete($keyvalues,$maintable);
		return $result;
	}

	static function do_add($keyvalues, $newvalues, $maintable){

		$result = CF_CrudLibPdo::CrudAdd($keyvalues, $newvalues, $maintable);
		return $result;
	}


	static function get_records($filter, $order = null, $limit = null){
		$basequery = "SELECT * FROM <main_table>  WHERE 1=1 ";
		$ar_data = get_array_query_full($basequery, $filter, $order);
		return $ar_data;
		
	}




	static function get_lookuplists($fs,$ar_columns,$set){

		//$table_id = lookup_value('main_table','crudsets'," crudset_id = " . $set['crudset_id']);
		//$set['source_id'] = $table_id;

		$lr = new CF_LookupResolver;
		$fs->SetupLookupResolver($lr);
		
		$ar_lookups = $lr->GetLists($ar_columns, $set);
		return $ar_lookups;

	}
}
?>